import { createAction } from 'redux-actions';
import { message } from 'antd';
import * as Immutable from 'seamless-immutable';
import * as _ from 'lodash';
import { ThunkAction } from 'redux';
import { ActionName } from './action';
import { ICreateNodeData } from './const';



/** 改变操作模式 */
const changeOperaTypeAction = createAction(ActionName.changeOperaType);
export const changeOperaType = (operaType: number): ThunkAction<void, any, any> => (dispatch, getState) => {
    dispatch(changeOperaTypeAction({ operaType }));
};
/** 新增节点 */
const createNodeAction = createAction(ActionName.createNode);
export const createNode = (createNodeData: ICreateNodeData): ThunkAction<void, any, any> => (dispatch, getState) => {
    dispatch(createNodeAction({ createNodeData }));
};
/** 执行新增节点 */
const doCreateNodeAction = createAction(ActionName.doCreateNode);
export const doCreateNode = (createNodeData: ICreateNodeData): ThunkAction<void, any, any> => (dispatch, getState) => {
    dispatch(doCreateNodeAction({ createNodeData }));
};
/** 清除新增节点标记 */
const clearCreateNodeDataAction = createAction(ActionName.clearCreateNodeData);
export const clearCreateNodeData = (): ThunkAction<void, any, any> => (dispatch, getState) => {
    dispatch(clearCreateNodeDataAction());
};
